<?php
require_once "dispose.interface.php";
/**
 *
* Copyright(c) 201x,
* All rights reserved.
*
* 功 能：
* @author cabing_2005@126.com
* @date 2014-8-15
* 版 本：1.0
 */
class FileDispose implements Dispose {

    /**
     * 分发数据
     * @param string file
     */
    public static function  dispose($params)
    {
        if(!is_array($params) || !isset($params["content"]) || !isset($params["file"])){
            throw new FileDisposeException("params not right in ".__LINE__);
        }
        $fp = fopen($params["file"],"a+");
        if(!$fp){
            throw new FileDisposeException("can't open the file ");
        }
        fwrite($fp, $params["content"]."\n");
        fclose($fp);
    }

}
class FileDisposeException extends Exception{};
